package com.xsmart.goods.api;

import com.xsmart.common.entity.RequestBean;
import com.xsmart.common.entity.ResponseBean;
import com.xsmart.goods.services.GoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/api")
public class GoodsTypeController {
    @Autowired
    GoodsTypeService goodsTypeService;

    @RequestMapping(value = "/v1/GoodsTypeService/queryGoodsType", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean queryGoodsType(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return goodsTypeService.queryGoodsType(requestBean);
    }

    @RequestMapping(value = "/v1/GoodsTypeService/addGoodsType", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean addGoodsType(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return goodsTypeService.addGoodsType(requestBean);
    }

    @RequestMapping(value = "/v1/GoodsTypeService/modGoodsType", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean modGoodsType(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return goodsTypeService.modGoodsType(requestBean);
    }
    @RequestMapping(value = "/v1/GoodsTypeService/delGoodsType", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean delGoodsType(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return goodsTypeService.delGoodsType(requestBean);
    }
    @RequestMapping(value = "/v1/GoodsTypeService/queryAllGoodsType", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean queryAllGoodsType(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return goodsTypeService.queryAllGoodsType(requestBean);
    }
}
